Lua/Events/Client/MouseDown
From JC2-MP Documentation
< Lua
Name | MouseDown |
---|---|
Arguments (in table) | number button |
Return option | None |
Description
Fired when a mouse button is pressed.
button is from 1 to 5:
- Left click
- Right click
- Middle click
- Back button
- Forward button
Examples
Foo = function(args) local message = "Mouse button "..args.button.." pressed" Chat:Print(message, Color(255, 255, 255)) end Events:Subscribe("MouseDown", Foo)
Foo = function(args) if args.button == 1 then local position = Mouse:GetPosition() local message = "Player left-clicked at position x: " .. position.x .. " y: " .. position.y Chat:Print(message, Color(255, 255, 255)) end end Events:Subscribe("MouseDown", Foo)